package com.hzlj.position.config.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fz.common.base.converter.RemoveWrapperPlus;
import com.fz.common.base.dto.DeleteCommonDTO;
import com.hzlj.position.config.common.model.JzJbxxConfig;
import com.hzlj.position.config.mapper.JzJbxxConfigMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * 矫正-基本信息-配置(JzJbxxConfig)表操作类
 *
 * @author lifh
 * @date 2023-03-29 13:50:02
 */
@Repository
public class JzJbxxConfigDao extends ServiceImpl<JzJbxxConfigMapper, JzJbxxConfig> {
    @Resource
    private JzJbxxConfigMapper jzJbxxConfigMapper;

    public JzJbxxConfig getJzJbxxConfigByJzId(String jzId) {
        LambdaQueryWrapper<JzJbxxConfig> queryWrapper = new QueryWrapper<JzJbxxConfig>().lambda()
                .eq(JzJbxxConfig::getId, jzId);
        return this.getOne(queryWrapper);
    }


    /**
     * 修改数据
     *
     * @param dto 实例对象
     * @return 实例对象
     */
    public boolean updateJzJbxxConfig(JzJbxxConfig dto) {
        LambdaQueryWrapper<JzJbxxConfig> queryWrapper = new QueryWrapper<JzJbxxConfig>().lambda()
                .eq(JzJbxxConfig::getId, dto.getId());
        return this.update(dto, queryWrapper);
    }

    /**
     * 删除数据
     *
     * @param dto 实例对象
     * @return 是否成功
     */
    public boolean deleteJzJbxxConfig(DeleteCommonDTO<String> dto) {
        return RemoveWrapperPlus.remove(this, dto);
    }


}

